package com.hzit.controller;

import com.hzit.config.StudentConverter;
import com.hzit.dto.ClassesDTO;
import com.hzit.dto.StudentDTO;
import com.hzit.service.IClassesService;
import com.hzit.service.IStudentService;
import com.hzit.vo.StudentVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
@Controller
@RequestMapping("/classes")
public class ClassesController {
	@Autowired
	private IClassesService classesService;

	//1. 查询班级列表
	@GetMapping("/list")
	public String list(Model model){
		//1.1 查询返回班级列表
		List<ClassesDTO> classesDTOS = classesService.findAll();
		//1.2 将班级对象列表放到model中
		model.addAttribute("classes",classesDTOS);
		//1.3 返回视图
		return "list";
	}


}
